package com.fs.sw.common.exception.handler;

import com.fs.sw.bo.ResultBO;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {
	
    /**
     * 处理所有参数错误的异常
     */
    @ExceptionHandler(value= {Exception.class})
    @ResponseBody
    ResultBO<Void> handleRuntimeException(Exception e){
    	ResultBO<Void> response = new ResultBO<Void>();
    	response.getHead().setStatus(-1);
        response.getHead().setMessage(e.getMessage());
        return response;
    }

}
